/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package framework.view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

/**
 *
 * @author ThanhNguyen
 */
public abstract class AddAccountDialog extends AbstractDialog {

    private JLabel JLabel1;
    private JLabel JLabel2;
    private JLabel JLabel3;
    private JLabel JLabel4;
    private JLabel JLabel5;
    private JLabel JLabel7;
    private JTextField JTextField_NAME;
    private JTextField JTextField_CT;
    private JTextField JTextField_ST;
    private JTextField JTextField_STR;
    private JTextField JTextField_ZIP;
    private JTextField JTextField_EM;
    private JButton JButton_OK;
    private JButton JButton_Cancel;

    @Override
    public void initComponents() {
        initDialog();
        initCustomerControls();
        initAccountTypeControls();
        initAccountControls();
        initButtons();
    }

    public void initCustomerControls() {
        JLabel1 = new JLabel();
        JLabel2 = new JLabel();
        JLabel3 = new JLabel();
        JLabel4 = new JLabel();
        JLabel5 = new JLabel();
        JLabel7 = new JLabel();
        JTextField_NAME = new JTextField();
        JTextField_CT = new JTextField();
        JTextField_ST = new JTextField();
        JTextField_STR = new JTextField();
        JTextField_ZIP = new JTextField();
        JTextField_EM = new JTextField();
        JButton_OK = new JButton();
        JButton_Cancel = new JButton();
        int x = 20;
        int y = 20;
        JLabel1 = new JLabel();
        JLabel1.setText("Name");
        getContentPane().add(JLabel1);
        JLabel1.setForeground(java.awt.Color.black);
        JLabel1.setBounds(12 + y, 54 + x, 48, 24);
        JLabel2.setText("Street");
        getContentPane().add(JLabel2);
        JLabel2.setForeground(java.awt.Color.black);
        JLabel2.setBounds(12 + y, 78 + x, 48, 24);
        JLabel3.setText("City");
        getContentPane().add(JLabel3);
        JLabel3.setForeground(java.awt.Color.black);
        JLabel3.setBounds(12 + y, 102 + x, 48, 24);
        JLabel4.setText("State");
        getContentPane().add(JLabel4);
        JLabel4.setForeground(java.awt.Color.black);
        JLabel4.setBounds(12 + y, 126 + x, 48, 24);
        JLabel5.setText("Zip");
        getContentPane().add(JLabel5);
        JLabel5.setForeground(java.awt.Color.black);
        JLabel5.setBounds(12 + y, 150 + x, 48, 24);
        JLabel7.setText("Email");
        getContentPane().add(JLabel7);
        JLabel7.setForeground(java.awt.Color.black);
        JLabel7.setBounds(12 + y, 174 + x, 48, 24);
        getContentPane().add(JTextField_NAME);
        JTextField_NAME.setBounds(84 + y, 54 + x, 156, 20);
        getContentPane().add(JTextField_CT);
        JTextField_CT.setBounds(84 + y, 102 + x, 156, 20);
        getContentPane().add(JTextField_ST);
        JTextField_ST.setBounds(84 + y, 126 + x, 156, 20);
        getContentPane().add(JTextField_STR);
        JTextField_STR.setBounds(84 + y, 78 + x, 156, 20);
        getContentPane().add(JTextField_ZIP);
        JTextField_ZIP.setBounds(84 + y, 150 + x, 156, 20);
        getContentPane().add(JTextField_EM);
        JTextField_EM.setBounds(84 + y, 174 + x, 156, 20);
    }

    public abstract void initDialog();

    public abstract void initAccountTypeControls();

    public abstract void initAccountControls();

    @Override
    public HashMap<String, String> getFields() {
        HashMap<String, String> fields = super.getFields();
        fields.put("name", JTextField_NAME.getText());
        fields.put("street", JTextField_STR.getText());
        fields.put("city", JTextField_CT.getText());
        fields.put("state", JTextField_ST.getText());
        fields.put("zip", JTextField_ZIP.getText());
        fields.put("email", JTextField_EM.getText());
        return fields;
    }

    public void initButtons() {
        int x = 40;
        int y = 20;
        JButton_OK.setText("OK");
        JButton_OK.setActionCommand("OK");
        getContentPane().add(JButton_OK);
        JButton_OK.setBounds(48 + y, 234 + x, 84, 24);
        JButton_Cancel.setText("Cancel");
        JButton_Cancel.setActionCommand("Cancel");
        getContentPane().add(JButton_Cancel);
        JButton_Cancel.setBounds(156 + y, 234 + x, 84, 24);
        JButton_OK.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                OK = true;
                dispose();
            }
        });
        JButton_Cancel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                dispose();
            }
        });
    }
}
